//
// Created by Administrator on 2021/1/1 0001.
//

#include "instance_method_access.h"
#include <stdio.h>

JNIEXPORT void JNICALL
Java_com_yangyongfeng_JNI_1library_InstanceMethodAccess_nativeMethod(JNIEnv *env, jobject obj)
{
    jclass  cls;
    jmethodID  method_id;

    printf("Run in C :\n");
    cls = (*env).GetObjectClass(obj);
    if (cls == NULL){
        return;
    }

    method_id  = (*env).GetMethodID(cls,"callback","()V");
    if (method_id == NULL){
        return;
    }

    (*env).CallVoidMethod(obj,method_id);
}